1. Field of the Invention
The present invention relates to computer memory systems, and in particular to optimizing the performance of a disk cache.
2. Background of the Related Art
A cache is a computer system component on which data can be stored on behalf of a storage device, and from which data may be accessed faster than from the storage device. Cache generally has much less capacity than the corresponding storage device, and is therefore used to store data that is likely to be requested again, such as the more relevant or more recent data. Several different layers of cache are provided in a modern computer system. Level 1 (or primary) cache, for example, is used to store data on behalf of system memory (which comprises random access memory, i.e. RAM) for access by a processor. Level 1 cache can be built directly into the processor and can run at the same speed as the processor, providing the fastest possible access time. Level 2 (or secondary) cache is also used to store a portion of system memory and may be included within a chip package, but is separate from the processor. Level 2 cache has greater capacity than Level 1 cache, but is slower. A disk cache is used to store reads and writes from the hard disk drive (HDD). In many systems, the disk cache is the most important type of cache in terms of its effect on system performance because of the especially large differential in speed between system memory and the HDD. Disk cache may be used a variety of mediums, such as Flash, DRAM, eDRAM, or SRAM.
Memory transfers between the HDD and the disk cache are typically handled in pages. A page is the smallest unit of data for transfer between the disk cache (residing in main memory) and the HDD, where the pages are arranged within the disk cache in blocks. For example, a 128 kilobyte (KB) block may have a total of sixty-four 2 KB pages. Every new write causes a new page to be written to the disk cache, which invalidates any previous page with the same corresponding address range that may have already been in the disk cache. Writes can render a large portion of a disk cache unusable due to the accumulation of invalid pages, particularly in a unified cache in which reads and writes are not segregated. An invalid page can be recovered for use only after the entire block containing the page is “erased.” The “erase” operation affects the access latency of the hard disk, and therefore is only done when the fraction of free writable pages is small (typically, when the free writable pages comprise less than 20% of all pages). Meanwhile, a large fraction of the pages may be invalid. This can adversely affect the disk cache's hit rate since the disk cache may be effectively much smaller than its rated size.
In contrast to a unified cache, some caches are split into separate read and write portions, wherein data associated with writes is cached to the write portion and data associated with reads is cached to the read portion. Split disk caches are often preferred when using NAND Flash cells. In a split disk cache, the write portion experiences most of the invalidated pages within the cache, which triggers more frequent block erasures within the write portion, while keeping the read portion relatively immune to the page invalidation problem. The read portion remains largely undiminished, and the cache achieves better hit rates overall. While the write latency may increase due to the more frequent block erasures, write latency is generally less critical to application behavior than read latency.